<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>M3U8格式视频解析</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="Author" content="larry" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="/static/admin/common/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/backstage/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/common/css/animate.css" media="all">
    <link rel="stylesheet" type="text/css" href="/static/admin/backstage/css/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="larry-container larryms-admin">
        <div class="layui-row layui-col-space20">
            <div class="layui-col-xs12 animated fadeInRightBig">
                <section class="larry-panel">

                    <div class="larryms-page-header">
                        <span class="tit">M3U8格式视频解析</span>
                    </div>
                    <div class="larryms-page-body">
                        <form class="layui-form" method="get">
                            <div class="layui-form-item">
                                <label class="layui-form-label">输入后缀.m3u8地址</label>
                                <div class="layui-input-block">
                                    <input type="text" name="url" value="https://dy2.jsyunbf.com/20180706/g8PPPUN7/index.m3u8" class="layui-input" placeholder="请输入要下载文件的URL">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="m3u8">解析视频</button>
                                    <a href="" class="layui-btn layui-btn-normal" id="bofang" target="_blank" style="display: none">点击播放</a>
                                    <a type="reset" class="layui-btn layui-btn-danger" href="javascript:history.go(-1);">返回</a>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <div id="a1"></div>
                                </div>
                            </div>
                        </form>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
<!-- 加载js文件-->
<script type="text/javascript" src="/static/admin/common/layui/layui.js"></script>
<script type="text/javascript" src="/static/admin/my/js/ckplayer.js"></script>




<script>
    //Demo
    layui.use(['form', 'layer'], function(){
        var form = layui.form;
        var $ = layui.$ //重点处
            ,layer = layui.layer;
        //ajax表单提交
        form.on("submit(m3u8)", function(data){
            $.ajax({
                type:"GET",
                url:"{:url('admin/tool/m3u8')}",
                dataType:"JSON",
                data:data.field,
                success:function(res){
                    if(res.code == '1'){
                        layer.msg(res.msg, {icon: 6});
                        var flashvars={
                            f: '/static/admin/my/flash/m3u8.swf', 		//使用swf向播放器发送视频地址进行播放
                            a: res.url,
                            c: 0,		//调用 ckplayer.js 配置播放器
                            p: 1,		//自动播放视频
                            s: 4,		//flash插件形式发送视频流地址给播放器进行播放
                            lv: 0
                        };
                        var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
                        $(document).ready(function() {
                            $('#a1').css('height', $(window).height());
                        });
                        CKobject.embedSWF('/static/admin/my/flash/ckplayer.swf','a1','ckplayer_a1','100%','86%;',flashvars,params);
                        // var isiPad = navigator.userAgent.match(/iPad|iPhone|Linux|Android|iPod/i) != null;
                        // if (isiPad) {
                        //     document.getElementById('a1').innerHTML = '<video src="'+purl+'" controls="controls" autoplay="autoplay" style="psotion:relative;""></video>'
                        // }else{
                        //     CKobject.embedSWF('/static/admin/my/flash/ckplayer.swf','a1','ckplayer_a1','600px','600px;',flashvars,params);
                        // }
                    }else{
                        layer.msg(res.msg, {icon: 5});

                    }
                }
            });
            return false;
        })
    });
</script>
</body>
</html>




